package cn.tedu.spring.security.controller;

import cn.tedu.spring.security.pojo.param.LoginParam;
import cn.tedu.spring.security.service.LoginService;
import cn.tedu.spring.security.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin")
@Api(tags = "登录")
public class AdminController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    @ApiOperation("验证登录")
    public JsonResult login(LoginParam loginParam){
        String jwt = loginService.login(loginParam);
        return JsonResult.ok(jwt);
    }

    @GetMapping("/out")
    @ApiOperation("退出登录")
    public String out(String username,String password){
        return "退出!";
    }
}
